<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAsyncExportTasksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('async_export_tasks', function (Blueprint $table) {
            $table->id();
            $table->char('task_numbering', 64)->comment('任务编号');
            $table->string('task_name')->comment('任务名称');
            $table->string('eigenvalues')->index()->comment('特征值,用来处理限流判断');
            $table->bigInteger('operator_id')->index()->comment('操作人 ID');
            $table->tinyInteger('status')->default(1)->comment('状态; 1:初始化 2:进行中 3:错误 4:已完成');
            $table->timestamp('start_at')->nullable()->comment('什么时候开始处理的');
            $table->timestamp('end_at')->nullable()->comment('什么时候结束的');
            $table->string('filed_message')->comment('错误信息');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('async_export_tasks');
    }
}
